const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  id: state => state.user.id,
  signature: state => state.user.signature,

  sex: state => {
    if(state.user.sex === 1){
      return '男'
    }else if(state.user.sex === 2){
      return '女'
    }else{
      return '未设置性别'
    }
  },
  phone: state => state.user.phone,
  sidebarActive:state=>{
    return state.chat.sidebarActive?state.chat.sidebarActive:'conversation-list'
  },
  friendActive:state=>state.chat.friendActive,
  currentFriendInfo:state=>state.chat.currentFriendInfo,
  requestMessageList:state=>state.chat.requestMessageList,
  friendList:state=>state.chat.friendList,
  conversationList:state=>state.chat.conversationList,
  currentConversation:state=>state.chat.currentConversation,
  conversationMessagesList:state=>state.chat.conversationMessagesList,
  uploadProgress:state=>state.chat.uploadProgress,
  userSign: state => state.user.userSign,
  currentMessageList:state=>state.chat.currentMessageList,
  // 消息接收人
  toAccount:state=>{
    if(!state.chat.currentConversation || !state.chat.currentConversation.conversationID){
      console.log("消息接收人为空")
      return ''
    }
    switch (state.chat.currentConversation.type) {
      case 'C2C':
        console.log("消息接收人："+state.chat.currentConversation.conversationID.replace('C2C',''))
        return state.chat.currentConversation.conversationID.replace('C2C','')
      case 'GROUP':
        return state.chat.currentConversation.conversationID.replace('GROUP','')
      default:
        return state.chat.currentConversation.conversationID
    }
  },
  isCompleted:state=>state.chat.isCompleted,
}
export default getters
